{extend name="layout/layout" /}

{block name="pagecss"}
<style>
    .btn_del_role{
        margin: 0 5px;
    }
</style>
{/block}

{block name="content"}
<div class="row js-check-wrap">
    <div class="col-lg-12">
        <div class="box box-success">
            <div class="box-header with-border">
                <div class="row">
                    <div class="col-md-9">
                        <form id="searchForm" class="form">
                            <div class="col-md-3" id="store">
                                {if condition="$admin.roleType == 2 "}  <!-- 店员登录 -->
                                <select  name="storeId" class="form-control" disabled>
                                    {volist name="store" id="vo"}
                                    <option value="{$vo.id}" {eq name="vo.id" value="$admin.storeId"}selected{/eq}  ><span>{$vo.name}</span></option>
                                    {/volist}
                                </select>
                                {else /}
                                <select  name="storeId" class="form-control" onchange="changeStore(this)">
                                    {volist name="store" id="vo"}
                                    <option value="{$vo.id}" {eq name="vo.id" value="$storeId"}selected{/eq}  ><span>{$vo.name}</span></option>
                                    {/volist}
                                </select>
                                {/if}                                
                            </div>
                            <div class="col-md-3" id="form1">
                                <div class="form-group">
                                    <select class="form-control" name="status">
                                        <option value="0">状态</option>
                                        <option value="使用中">使用中</option>
                                        <option value="已过期">已过期</option>
                                        <option value="未开始">未开始</option>
                                    </select>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="box-tools pull-right">
                    <button class="btn btn-primary btn-sm" id="add_coupon"><i class="fa fa-plus"></i> 发布优惠券</button>
                </div>
            </div>
            <div class="box-body ">
                <form class="js-ajax-form" method="post">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover table-checkable order-column" id="table_role">
                            <thead>
                            <tr>
                                <th>优惠券名称</th>
                                <th>金额（元）</th>
                                <th>获取条件</th>
                                <th>使用条件</th>
                                <th>总量</th>
                                <th>领取数量</th>
                                <th>有效期</th>
                                <th>创建时间</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="pagescript"}
<script>
    var index_url = "{:url('admin/coupon/index')}";   //获取代金券列表
    var list_url = "{:url('admin/coupon/indexApi')}";   //获取代金券列表
    var add_url = "{:url('admin/coupon/add')}";  //添加新的代金券
    var edit_url = "{:url('admin/coupon/edit')}";  //编辑
    var del_url = "{:url('admin/coupon/delete')}";  //删除
    var useList_url = "{:url('admin/coupon/useList')}";  //领取及使用记录
</script>
<script src="__STATIC__/admin/js/bootbox.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/js/include.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/coupon.js" type="text/javascript"></script>
{/block}